/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, io } = app;
  router.post('/login', controller.user.login);
  router.post('/register', controller.user.register);
  router.post('/user/list', controller.user.getUserList);
  router.post('/username', controller.user.getUsername);

  router.post('/project/list', controller.project.getProjectList);
  router.post('/project/list/search', controller.project.searchProjectList);
  router.post('/project/list/stared', controller.project.getStaredProjectList);
  router.post('/project/detail', controller.project.getProjectDetail);
  router.post('/project/create', controller.project.createProject);
  router.post('/project/delete', controller.project.deleteProject);
  router.post('/project/update', controller.project.updateProject);
  router.post('/project/star', controller.project.starProject);
  router.post('/project/member/list', controller.project.getMemberList);
  router.post('/project/member/add', controller.project.addMember);
  router.post('/project/member/delete', controller.project.deleteMember);

  router.post('/model/function', controller.model.getModelFunction);
  router.post('/model/module', controller.model.getModelModule);
  router.post('/model/architecture', controller.model.getModelArchitecture);
  router.post('/model/architecture/save', controller.model.saveModelArchitecture);

  router.post('/client/model/function', controller.client.getModelFunction);
  router.post('/client/model/function/save', controller.client.saveModelFunction);

  router.post('/client/model/module', controller.client.getModelModule);
  router.post('/client/model/module/save', controller.client.saveModelModule);

  router.post('/client/project/validate', controller.client.validateProject);

  io.of('/').route('archi', io.controller.nsp.sendArchi);
  io.of('/').route('saveArchi', io.controller.nsp.saveArchi);
};
